import request from '@/utils/request'

// 获取员工列表
export const sysUser = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}
// 新增员工
export const sysUserPost = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}
// 删除员工
export const sysUserDelete = (id) => {
  return request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}
// 批量新增员工
export const sysUserBatch = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}
// 修改员工信息
export const sysUserPut = (data) => {
  return request({
    url: '/sys/user/' + data.id,
    method: 'put',
    data
  })
}

/* 封装获取员工个人信息 */
export const employeesPersonalInfo = (id) => {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}
/* 修改员工个人信息 */
export const employeesPersonalInfoPut = (data) => {
  return request({
    url: `/employees/${data.userId}/personalInfo`, /* 这里的id 要看formData里面的id名字叫什么 */
    method: 'put',
    data
  })
}

/* 获取员工岗位的信息 */
export const employeesJobs = (id) => {
  return request({
    url: `/employees/${id}/jobs` /* 这里的id 要看formData里面的id名字叫什么 */
  })
}

/* 获取员工岗位的信息 */
export const employeesJobsPut = (data) => {
  return request({
    url: `/employees/${data.userId}/jobs`, /* 这里的id 要看formData里面的id名字叫什么 */
    method: 'PUT',
    data
  })
}

/* 给员工分配角色 */
export const sysUserAssignRoles = (data) => {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put',
    data
  })
}
